//package cn.bonoon.kernel.support;
//
//import java.util.Map;
//import java.util.concurrent.ConcurrentHashMap;
//
//import org.springframework.context.ApplicationContext;
//
//import cn.bonoon.kernel.bytecode.BytecodeFactory;
//import cn.bonoon.kernel.bytecode.EntityReader;
//import cn.bonoon.kernel.bytecode.QueryConverter;
//import cn.bonoon.kernel.events.ReadEvent;
//import cn.bonoon.kernel.support.entities.Persistable;
//
//public class StandardSearcher extends BaseSearcher{
//	protected static final float LOAD_FACTOR = 0.75f;
//	protected static final int CONCURRENCY_LEVEL = 2, INITIAL_CAPACITY = 4;
//	private final Map<Class<?>, EntityReader> valueReaders;
//	private final Map<Class<?>, QueryConverter> queryConverters;
//	protected final ApplicationContext applicationContext;
//	
//	public StandardSearcher(Class<? extends Persistable> entityClass, ApplicationContext applicationContext){
//		super(entityClass);
//		valueReaders = new ConcurrentHashMap<Class<?>, EntityReader>(INITIAL_CAPACITY, LOAD_FACTOR, CONCURRENCY_LEVEL);
//		queryConverters = new ConcurrentHashMap<Class<?>, QueryConverter>(INITIAL_CAPACITY, LOAD_FACTOR, CONCURRENCY_LEVEL);
//		
//		this.applicationContext = applicationContext;
//	}
//	
//	public StandardFinder finder(ProxyEntityManager manager, ReadEvent readEvent, Class<?> resultClassType)throws Exception{
//		return initFinder(new ExtendFinder(getEntityReader(resultClassType), readEvent, manager));
//	}
//	
//	public QueryConverter getQueryConverter(Class<?> cc)throws Exception{
//		QueryConverter qc = queryConverters.get(cc);
//		if(null == qc){
//			qc = BytecodeFactory.query(applicationContext, cc, entityDescriptor);
//			queryConverters.put(cc, qc);
//		}
//		return qc;
//	}
//	
//	public EntityReader getEntityReader(Class<?> rc)throws Exception{
//		EntityReader er = valueReaders.get(rc);
//		if(null == er){
//			er = BytecodeFactory.reader(applicationContext, rc, entityDescriptor);
//			valueReaders.put(rc, er);
//		}
//		return er;
//	}
//}
